<?xml version="1.0"?>

<st-source>
<time-stamp>From VisualWorks® NonCommercial, 7.6 of March 3, 2008 on April 1, 2009 at 1:49:28 pm</time-stamp>


<class>
<name>RetailerEditItemDialog</name>
<environment>SupplyChain</environment>
<super>UI.SimpleDialog</super>
<private>false</private>
<indexed-type>none</indexed-type>
<inst-vars>reorderPoint sellPrice item nameAspect skuAspect </inst-vars>
<class-inst-vars></class-inst-vars>
<imports></imports>
<category></category>
<attributes>
<package>SupplyChain</package>
</attributes>
</class>

<!-- -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   -->


<methods>
<class-id>SupplyChain.RetailerEditItemDialog class</class-id> <category>interface specs</category>

<body package="SupplyChain" selector="windowSpec">windowSpec
	"Tools.UIPainter new openOnClass: self andSelector: #windowSpec"

	&lt;resource: #canvas&gt;
	^#(#{UI.FullSpec} 
		#window: 
		#(#{UI.WindowSpec} 
			#label: 'Retailer Edit Item GUI' 
			#bounds: #(#{Graphics.Rectangle} 640 512 868 740 ) ) 
		#component: 
		#(#{UI.SpecCollection} 
			#collection: #(
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 3 203 ) 
					#name: #RetailerGUI 
					#label: 'Retailer GUI' ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 12 5 ) 
					#name: #itemNameLabel 
					#label: 'Name' ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 14 48 ) 
					#name: #buyPrice 
					#label: 'Buy Price:' ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 73 48 ) 
					#name: #moneyBuyPrice 
					#label: '$00.00' ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 14 75 ) 
					#name: #sellPrice 
					#label: 'Sell Price:' ) 
				#(#{UI.SpinButtonSpec} 
					#layout: #(#{Graphics.Rectangle} 102 73 201 96 ) 
					#name: #sellPrice 
					#model: #sellPrice 
					#type: #number ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 14 109 ) 
					#name: #reorderPoint 
					#label: 'Reorder Point:' ) 
				#(#{UI.SpinButtonSpec} 
					#layout: #(#{Graphics.Rectangle} 102 107 201 130 ) 
					#name: #reorderPoint 
					#model: #reorderPoint 
					#type: #number ) 
				#(#{UI.ActionButtonSpec} 
					#layout: #(#{Graphics.Rectangle} 8 159 89 182 ) 
					#name: #acceptButton 
					#model: #accept 
					#label: 'Done' 
					#defaultable: true ) 
				#(#{UI.ActionButtonSpec} 
					#layout: #(#{Graphics.Rectangle} 130 157 211 182 ) 
					#name: #cancel 
					#model: #cancel 
					#label: 'Cancel' 
					#defaultable: true ) 
				#(#{UI.InputFieldSpec} 
					#layout: #(#{Graphics.Rectangle} 48 6 215 29 ) 
					#name: #nameInputField 
					#model: #nameAspect ) 
				#(#{UI.LabelSpec} 
					#layout: #(#{Core.Point} 11 27 ) 
					#name: #skuLabel 
					#label: 'SKU' ) 
				#(#{UI.InputFieldSpec} 
					#layout: #(#{Graphics.Rectangle} 48 29 214 49 ) 
					#name: #skuField 
					#model: #skuAspect 
					#isReadOnly: false ) ) ) )</body>
</methods>

<methods>
<class-id>SupplyChain.RetailerEditItemDialog class</class-id> <category>instance creation</category>

<body package="SupplyChain" selector="showEditItem:">showEditItem: anItem
	| wnd item |
	item := anItem.
	wnd := self new.
	wnd model: item.
	^wnd open.</body>

<body package="SupplyChain" selector="showNewItem">showNewItem
	| wnd item |
	item := Item new.
	wnd := self new.
	wnd model: item.
	^(wnd open
		ifTrue: [ ^item ]
		ifFalse: [ ^nil ]
	)</body>
</methods>

<!-- -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   -->


<comment>
<class-id>SupplyChain.RetailerEditItemDialog</class-id>
<body>Retailer 

Instance Variables:
	reorderPoint	&lt;ValueHolder&gt;	description of reorderPoint
	sellPrice	&lt;ValueHolder&gt;	description of sellPrice

</body>
</comment>

<methods>
<class-id>SupplyChain.RetailerEditItemDialog</class-id> <category>aspects</category>

<body package="SupplyChain" selector="nameAspect">nameAspect
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^nameAspect isNil
		ifTrue:
			[nameAspect := String new asValue]
		ifFalse:
			[nameAspect]</body>

<body package="SupplyChain" selector="reorderPoint">reorderPoint
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^reorderPoint isNil
		ifTrue:
			[reorderPoint := 0 asValue]
		ifFalse:
			[reorderPoint]</body>

<body package="SupplyChain" selector="sellPrice">sellPrice
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^sellPrice isNil
		ifTrue:
			[sellPrice := 0 asValue]
		ifFalse:
			[sellPrice]</body>

<body package="SupplyChain" selector="skuAspect">skuAspect
	"This method was generated by UIDefiner.  Any edits made here
	may be lost whenever methods are automatically defined.  The
	initialization provided below may have been preempted by an
	initialize method."

	^skuAspect isNil
		ifTrue:
			[skuAspect := String new asValue]
		ifFalse:
			[skuAspect]</body>
</methods>

<methods>
<class-id>SupplyChain.RetailerEditItemDialog</class-id> <category>initialize-release</category>

<body package="SupplyChain" selector="initialize">initialize
	"Initialize a newly created instance. This method must answer the receiver."
	super initialize.
	item isNil
		ifTrue: [item := Item new].
	
	nameAspect := (UI.AspectAdaptor subject: item) forAspect: #name.
	sellPrice := (UI.AspectAdaptor subject: item) forAspect: #sellPrice.
	reorderPoint := (UI.AspectAdaptor subject: item) forAspect: #reorderPoint.
	skuAspect := (UI.AspectAdaptor subject: item) forAspect: #sku.
	
	^self</body>
</methods>

<methods>
<class-id>SupplyChain.RetailerEditItemDialog</class-id> <category>accessing</category>

<body package="SupplyChain" selector="item">item
	^item</body>

<body package="SupplyChain" selector="item:">item: anItem
	self model: anItem.
	^self.</body>

<body package="SupplyChain" selector="model:">model: anItem
	item := anItem.
	self changed: #name.
	self initialize.
	^self.</body>
</methods>

</st-source>
